<template>
  <div v-transfer-dom>
  <popup v-model="showBank" position="bottom" @on-hide="close1">
    <popup-header
      left-text="取消"
      right-text="确定"
      @on-click-left="close1"
      @on-click-right="choose">
      </popup-header>
    <picker 
      :data="banks" 
      v-model="bank" 
      @on-change="change" 
      ></picker>
  </popup>
</div>
</template>
<script>
import { Popup,TransferDom,Picker,PopupHeader } from 'vux'

export default {
  components:{
    Popup,
    Picker,
    PopupHeader
  },
  directives: {
    TransferDom
  },
  created(){
  },
  props:['show1'],
  data(){
    return {
      banks:[
          ["宜人贷","陆金服","人人贷","拍拍贷","微贷网","团贷网","点融网","积木盒子","投哪网","有利网","爱钱进","翼龙贷","麻袋财富","51人品","和信贷","小赢网金","搜易贷","宜贷网","开鑫贷","向上金服","PPmoney网贷","理财农场","你我贷","博金贷","银湖网","友金服","金投行","杉易贷","民贷天下","信用宝","道口贷","海融易","91旺财","洋钱罐","人人聚财","金开贷","石投金融","鹏金所","广州e贷","e融所","口袋理财","首金网","万盈金融","红岭创投","首E家","珠宝贷","奇乐融","短融网","e路同心","东方汇","合众e贷","广信贷","网利宝","捞财宝","嘉石榴","广金金服","生菜金融","链链金融","米庄理财","惠投无忧"],
        ],
      bank:[''],
      val:'',
      bankId:''
    }
  },
  methods:{
    change(val){
      let bankId = this.banks[0].indexOf(val[0])+1
      // //console.log(bankId)
      // this.$emit('getBank',{
      //   val:val,
      //   bankId:bankId
      // })
      this.val = val;
      this.bankId = bankId
    },
    choose(){
      if(this.val == ''){
        this.val = '宜人贷'
        this.bankId = '1'
      }
      // console.log(`${this.val}/${this.bankId}`);
      this.$emit('getBank',{
        val:this.val,
        bankId:this.bankId
      })
      this.close1()
    },
    close1(){
      this.$emit('close1',false)
    }
  },
  computed:{
    showBank:{
      get(){
        return this.show1
      },
      set(){

      }
    }
  }
}
</script>
<style lang="less">
  @import '../../../style/mixin.less';
  .vux-popup-header-right{
      color:#e64f2b !important;
    }
</style>
